﻿using System;

namespace housingsafety.server.Caching.Core
{
    public class CacheEntryOptions
    {
        public DateTimeOffset? AbsoluteExpiration { get; set; }

        public TimeSpan? AbsoluteExpirationRelativeToNow { get; set; }

        public TimeSpan? SlidingExpiration { get; set; }

        public static CacheEntryOptions FromAbsoluteExpirationRelativeToNow(TimeSpan ts)
        {
            return new CacheEntryOptions { AbsoluteExpirationRelativeToNow = ts };
        }

        public static CacheEntryOptions FromSlidingExpiration(TimeSpan ts)
        {
            return new CacheEntryOptions { SlidingExpiration = ts };
        }
    }
}
